package org.example.config;

import org.example.filter.CORSFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WebConfig {

    @Bean
    public FilterRegistrationBean<CORSFilter> corsFilterFilterRegistrationBean() {
        CORSFilter corsFilter = new CORSFilter();
        FilterRegistrationBean<CORSFilter> bean = new FilterRegistrationBean<>();
        bean.setFilter(corsFilter);
        bean.addUrlPatterns("/*"); // 所有的内容
        return bean;
    }
}
